//
//  DYShopHeadlinesDetailVC.m
//  kafuMerchant
//
//  Created by 帝云科技 on 2018/9/25.
//  Copyright © 2018年 帝云科技. All rights reserved.
//

#import "DYShopHeadlinesDetailVC.h"
#import "DYAddBranchShopCell.h"
#import "DYShopDecorateCell.h"
#import "DYShopDecorateInputInfoCell.h"
#import "DYShopHeadlinesDetailWebVC.h"

@interface DYShopHeadlinesDetailVC ()


@property (nonatomic,strong)NSArray *titleArray;

@end


@implementation DYShopHeadlinesDetailVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title=@"头条详情";
    [self createRightBarItem:nil titleString:@"预览"];
    UIButton *rightBtn=self.navigationItem.rightBarButtonItem.customView;
    [rightBtn setTitleColor:[UIColor xhq_content] forState:UIControlStateNormal];
}
-(void)rightClick
{
    DYShopHeadlinesDetailWebVC *vc=[[DYShopHeadlinesDetailWebVC alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}
-(void)dy_initData
{
    [super dy_initData];
    
    self.titleArray=@[@"头条标题",@"所属分类",@"缩略图片",@"内容简介",@"头条内容"];
}
-(void)dy_initUI
{
    [super dy_initUI];
    
    self.tableView.backgroundColor=WhiteColor;
    
    [self.tableView registerClass:[DYAddBranchShopCell
                                   class] forCellReuseIdentifier:@"DYAddBranchShopCell"];
    [self.tableView registerClass:[DYShopDecorateCell
                                   class] forCellReuseIdentifier:@"DYShopDecorateCell"];
    [self.tableView registerClass:[DYShopDecorateInputInfoCell
                                   class] forCellReuseIdentifier:@"DYShopDecorateInputInfoCell"];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 5;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row==2) {
         return BILIHEIGHT(100);
    }else if (indexPath.row==3||indexPath.row==4){
       return BILIHEIGHT(180);
    }
    return BILIHEIGHT(58);
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row==2) {
        DYShopDecorateCell *cell=[tableView dequeueReusableCellWithIdentifier:@"DYShopDecorateCell" forIndexPath:indexPath];
        cell.titleLabel.text=self.titleArray[indexPath.row];
        cell.imageNumber=1;
        cell.hideSeparatorLabel=NO;
//        @weakify(self);
        cell.imageBlock = ^(NSMutableArray *imageArray) {
//            @strongify(self);
//           self.shopLogoArray=imageArray;
//            [self.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:indexPath.row inSection:0]] withRowAnimation:UITableViewRowAnimationFade];
        };
        
        return cell;
    }else if (indexPath.row==3||indexPath.row==4){
        DYShopDecorateInputInfoCell *cell=[tableView dequeueReusableCellWithIdentifier:@"DYShopDecorateInputInfoCell" forIndexPath:indexPath];
       cell.titleLabel.text=self.titleArray[indexPath.row];
        cell.infoTextView.userInteractionEnabled=NO;
        cell.hideSeparatorLabel=YES;
        return cell;
    }
    DYAddBranchShopCell *cell=[tableView dequeueReusableCellWithIdentifier:@"DYAddBranchShopCell" forIndexPath:indexPath];
    cell.titleLabel.text=self.titleArray[indexPath.row];
    cell.textField.enabled=NO;
    return cell;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
